<template>
  <div class="my-publish">
    <common-breadcrumb :crumb="crubm"></common-breadcrumb>
    <el-card>
      <el-table :data="tableData" border stripe>
        <el-table-column label="#" type="index"></el-table-column>
        <el-table-column label="api描述" prop="request_desc"></el-table-column>
        <el-table-column label="请求URL" prop="request_url"></el-table-column>
        <el-table-column label="请求方法" prop="request_methods"></el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-button type="primary" size="mini" @click="viewDetail(scope.row.id)">详情</el-button>
            <el-button type="warning" size="mini" @click="editApi(scope.row.id)">修改</el-button>
            <el-button type="danger" size="mini">修改接口状态</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import commonBreadcrumb from '../../components/common/Breadcrumb'
export default {
  components: {
    commonBreadcrumb
  },
  data () {
    return {
      crubm: ['管理', '我发布的api'],
      username: window.sessionStorage.getItem('username'),
      tableData: []
    }
  },
  created () {
    this.getMyPublishApi()
  },
  methods: {
    async getMyPublishApi () {
      const { data: res } = await this.$axios(`mypublish/${this.username}`)
      this.tableData = res.result
    },
    viewDetail (id) {},
    editApi (id) {}
  }
}
</script>

<style>
</style>
